// GxPriceEventSink.cpp : implementation file
//

#include "stdafx.h"
#include "speedorder.h"
#include "GxPriceEventSink.h"
#include "P2_i.c"
#include "CurPriceManager.h"
#include "SymbolManager.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// GxPriceEventSink

IMPLEMENT_DYNCREATE(GxPriceEventSink, CCmdTarget)

GxPriceEventSink::GxPriceEventSink()
{
	EnableAutomation();
	m_SymbolMgr = NULL;
}

GxPriceEventSink::~GxPriceEventSink()
{
}


void GxPriceEventSink::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.
	m_Cookie = 0;
	CCmdTarget::OnFinalRelease();
}


BEGIN_MESSAGE_MAP(GxPriceEventSink, CCmdTarget)
	//{{AFX_MSG_MAP(GxPriceEventSink)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(GxPriceEventSink, CCmdTarget)
	//{{AFX_DISPATCH_MAP(GxPriceEventSink)
	DISP_FUNCTION(GxPriceEventSink, "OnPriceChanged", OnPriceChanged, VT_EMPTY, VTS_DISPATCH)
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IGxPriceEventSink to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {C5D52671-59F2-47B3-A7C6-6F6451CA2B33}

BEGIN_INTERFACE_MAP(GxPriceEventSink, CCmdTarget)
	INTERFACE_PART(GxPriceEventSink, DIID_IGxSymbolEvents, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// GxPriceEventSink message handlers

void GxPriceEventSink::OnPriceChanged(LPDISPATCH a_GxSymbol) 
{
	// TODO: Add your dispatch handler code here
	if (m_SymbolMgr == NULL) return;
	
	m_SymbolMgr->OnPriceChanged(a_GxSymbol);
}
